package com.tools.common.model;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.time.LocalDateTime;

@Getter
@Setter
public class BaseEntity implements Serializable {

    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description="主键")
    private Long id;

    @Schema(description="逻辑删除 0否 1是")
    private Integer delFlag = 0;


    @TableField(value = "create_user_id", fill = FieldFill.INSERT)
    @Schema(description="创建人ID：插入时自动填充")
    private String createUserId;

    @TableField(value = "create_user", fill = FieldFill.INSERT)
    @Schema(description="创建人名称：插入时自动填充")
    private String createUser;



    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description="创建时间：插入时自动填充")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField(value = "update_user_id", fill = FieldFill.INSERT_UPDATE)
    @Schema(description="更新人ID：插入更新时自动填充")
    private String updateUserId;
    @TableField(value = "update_user", fill = FieldFill.INSERT_UPDATE)
    @Schema(description="更新人名称：插入更新时自动填充")
    private String updateUser;


    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description="更新时间：插入更新时自动填充")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

}
